package com.byq.mm.smartlib.connection;


import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.util.Log;

import com.byq.mm.smartlib.application.SmartApplication;

public class ConnectivityReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		Log.d(ConnectivityReceiver.class.getSimpleName(), intent.getAction() + intent.getExtras());
		ConnectivityManager connec = (ConnectivityManager) context
				.getSystemService(Context.CONNECTIVITY_SERVICE);

		boolean b = connec.getActiveNetworkInfo() != null;
		
		if (!b)
			return;
		SmartApplication app = (SmartApplication) context.getApplicationContext().getApplicationContext();
		app.getLoginManager().sendLogin();

	}

}
